<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Kinetis Bootloader Host: elftosb::EncoreBootImage::BootCommand Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Kinetis Bootloader Host
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
   <div id="projectbrief">Host Tools for Kinetis devices</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Introduction</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classelftosb_1_1_encore_boot_image_1_1_boot_command.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-types">Protected Types</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classelftosb_1_1_encore_boot_image_1_1_boot_command-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">elftosb::EncoreBootImage::BootCommand Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Abstract base class for all bootloader commands.  
 <a href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_encore_boot_image_8h_source.html">EncoreBootImage.h</a>&gt;</code></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for elftosb::EncoreBootImage::BootCommand:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" frameborder="0" src="classelftosb_1_1_encore_boot_image_1_1_boot_command__inherit__graph.svg" width="838" height="640"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div id="dynsection-1" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-1-trigger" src="closed.png" alt="+"/> Collaboration diagram for elftosb::EncoreBootImage::BootCommand:</div>
<div id="dynsection-1-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-1-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" frameborder="0" src="classelftosb_1_1_encore_boot_image_1_1_boot_command__coll__graph.svg" width="182" height="142"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac20b874eb88952931204d1ea0f98267f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac20b874eb88952931204d1ea0f98267f"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#ac20b874eb88952931204d1ea0f98267f">BootCommand</a> ()</td></tr>
<tr class="memdesc:ac20b874eb88952931204d1ea0f98267f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <br /></td></tr>
<tr class="separator:ac20b874eb88952931204d1ea0f98267f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae7d5a2f3eb06e9e5506be3d10b66e2c6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae7d5a2f3eb06e9e5506be3d10b66e2c6"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#ae7d5a2f3eb06e9e5506be3d10b66e2c6">~BootCommand</a> ()</td></tr>
<tr class="memdesc:ae7d5a2f3eb06e9e5506be3d10b66e2c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:ae7d5a2f3eb06e9e5506be3d10b66e2c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7e73ff007dd5a179952b089930e684a"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#ac7e73ff007dd5a179952b089930e684a">initFromData</a> (const cipher_block_t *blocks, unsigned count, unsigned *consumed)=0</td></tr>
<tr class="memdesc:ac7e73ff007dd5a179952b089930e684a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the command contents from raw data.  <a href="#ac7e73ff007dd5a179952b089930e684a">More...</a><br /></td></tr>
<tr class="separator:ac7e73ff007dd5a179952b089930e684a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Header</div></td></tr>
<tr class="memitem:a7e20c9089c4ec64287617372b309ac5f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7e20c9089c4ec64287617372b309ac5f"></a>
virtual uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a7e20c9089c4ec64287617372b309ac5f">getTag</a> () const  =0</td></tr>
<tr class="memdesc:a7e20c9089c4ec64287617372b309ac5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pure virtual method to return the tag value for this command. <br /></td></tr>
<tr class="separator:a7e20c9089c4ec64287617372b309ac5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fb0524a1f442d2666ae6d8cbb752237"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0fb0524a1f442d2666ae6d8cbb752237"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a0fb0524a1f442d2666ae6d8cbb752237">fillCommandHeader</a> (<a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> &amp;header)=0</td></tr>
<tr class="memdesc:a0fb0524a1f442d2666ae6d8cbb752237"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pure virtual method to construct the header for this boot command. <br /></td></tr>
<tr class="separator:a0fb0524a1f442d2666ae6d8cbb752237"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a828dda19e5c8e1a0628a39bf90b39fda"><td class="memItemLeft" align="right" valign="top">virtual uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a828dda19e5c8e1a0628a39bf90b39fda">calculateChecksum</a> (const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> &amp;header)</td></tr>
<tr class="memdesc:a828dda19e5c8e1a0628a39bf90b39fda"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the checksum for the given command header.  <a href="#a828dda19e5c8e1a0628a39bf90b39fda">More...</a><br /></td></tr>
<tr class="separator:a828dda19e5c8e1a0628a39bf90b39fda"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Cipher blocks</div></td></tr>
<tr class="memitem:ac8e41c77785db7a486b8102360bea785"><td class="memItemLeft" align="right" valign="top">virtual unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#ac8e41c77785db7a486b8102360bea785">getBlockCount</a> () const </td></tr>
<tr class="memdesc:ac8e41c77785db7a486b8102360bea785"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the total number of cipher blocks.  <a href="#ac8e41c77785db7a486b8102360bea785">More...</a><br /></td></tr>
<tr class="separator:ac8e41c77785db7a486b8102360bea785"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd1b5489a1a8899b707a9b366d0971c8"><td class="memItemLeft" align="right" valign="top">virtual unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#acd1b5489a1a8899b707a9b366d0971c8">getBlocks</a> (unsigned offset, unsigned maxCount, cipher_block_t *data)</td></tr>
<tr class="memdesc:acd1b5489a1a8899b707a9b366d0971c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the contents of up to <em>maxCount</em> cipher blocks.  <a href="#acd1b5489a1a8899b707a9b366d0971c8">More...</a><br /></td></tr>
<tr class="separator:acd1b5489a1a8899b707a9b366d0971c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Data blocks</div></td></tr>
<tr class="memitem:a63457e77b2372a479df45aa9a1c205b0"><td class="memItemLeft" align="right" valign="top">virtual unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a63457e77b2372a479df45aa9a1c205b0">getDataBlockCount</a> () const </td></tr>
<tr class="memdesc:a63457e77b2372a479df45aa9a1c205b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of data cipher blocks that follow this command.  <a href="#a63457e77b2372a479df45aa9a1c205b0">More...</a><br /></td></tr>
<tr class="separator:a63457e77b2372a479df45aa9a1c205b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a46b3519a49537325f27f3ec556ed176d"><td class="memItemLeft" align="right" valign="top">virtual unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a46b3519a49537325f27f3ec556ed176d">getDataBlocks</a> (unsigned offset, unsigned maxCount, cipher_block_t *data)</td></tr>
<tr class="memdesc:a46b3519a49537325f27f3ec556ed176d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the contents of up to <em>maxCount</em> data blocks.  <a href="#a46b3519a49537325f27f3ec556ed176d">More...</a><br /></td></tr>
<tr class="separator:a46b3519a49537325f27f3ec556ed176d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator.html">elftosb::EncoreBootImage::CipherBlockGenerator</a></td></tr>
<tr class="memitem:a80773110e06a465fa8c9184ccf51c06d inherit pub_methods_classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a80773110e06a465fa8c9184ccf51c06d"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator.html#a80773110e06a465fa8c9184ccf51c06d">debugPrint</a> () const </td></tr>
<tr class="memdesc:a80773110e06a465fa8c9184ccf51c06d inherit pub_methods_classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print out a string representation of the object. <br /></td></tr>
<tr class="separator:a80773110e06a465fa8c9184ccf51c06d inherit pub_methods_classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a5ffcb1578efd1531c594b64faf2163f1"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html">BootCommand</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a5ffcb1578efd1531c594b64faf2163f1">createFromData</a> (const cipher_block_t *blocks, unsigned count, unsigned *consumed)</td></tr>
<tr class="memdesc:a5ffcb1578efd1531c594b64faf2163f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates the correct subclass of <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html" title="Abstract base class for all bootloader commands. ">BootCommand</a> for the given raw data.  <a href="#a5ffcb1578efd1531c594b64faf2163f1">More...</a><br /></td></tr>
<tr class="separator:a5ffcb1578efd1531c594b64faf2163f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-types"></a>
Protected Types</h2></td></tr>
<tr class="memitem:a860e4a7f504f14254a28002418d78e2c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a860e4a7f504f14254a28002418d78e2c"></a>enum &#160;</td><td class="memItemRight" valign="bottom">{ <br />
&#160;&#160;<b>CMD_TAG_FIELD</b> = 1, 
<br />
&#160;&#160;<b>CMD_FLAGS_FIELD</b> = 2, 
<br />
&#160;&#160;<b>CMD_ADDRESS_FIELD</b> = 4, 
<br />
&#160;&#160;<b>CMD_COUNT_FIELD</b> = 8, 
<br />
&#160;&#160;<b>CMD_DATA_FIELD</b> = 16
<br />
 }<tr class="memdesc:a860e4a7f504f14254a28002418d78e2c"><td class="mdescLeft">&#160;</td><td class="mdescRight">The flag bit values for the <em>whichFields</em> parameter of <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a5ed39355be6653d7665cb91ef24361e5">validateHeader()</a>. <br /></td></tr>
</td></tr>
<tr class="separator:a860e4a7f504f14254a28002418d78e2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a5ed39355be6653d7665cb91ef24361e5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html#a5ed39355be6653d7665cb91ef24361e5">validateHeader</a> (const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> *modelHeader, const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> *testHeader, unsigned whichFields)</td></tr>
<tr class="separator:a5ed39355be6653d7665cb91ef24361e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract base class for all bootloader commands. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a828dda19e5c8e1a0628a39bf90b39fda"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t EncoreBootImage::BootCommand::calculateChecksum </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> &amp;&#160;</td>
          <td class="paramname"><em>header</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Calculates the checksum for the given command header. </p>
<p>The checksum algorithm is totally straightforward, except that the initial checksum byte value is set to 0x5a instead of 0. </p>

</div>
</div>
<a class="anchor" id="a5ffcb1578efd1531c594b64faf2163f1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html">EncoreBootImage::BootCommand</a> * EncoreBootImage::BootCommand::createFromData </td>
          <td>(</td>
          <td class="paramtype">const cipher_block_t *&#160;</td>
          <td class="paramname"><em>blocks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned *&#160;</td>
          <td class="paramname"><em>consumed</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Creates the correct subclass of <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html" title="Abstract base class for all bootloader commands. ">BootCommand</a> for the given raw data. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">blocks</td><td>Pointer to the raw data blocks. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">count</td><td>Number of blocks pointed to by <em>blocks</em>. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">consumed</td><td>On exit, this points to the number of cipher blocks that were occupied by the command. Should be at least 1 for every command. This must not be NULL on entry!</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new boot command instance. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NULL</td><td>The boot command pointed to by <em>blocks</em> was not recognized as a known command type.</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::runtime_error</td><td>This exception indicates that a command was recognized but contained invalid data. Compare this to a NULL result which indicates that no command was recognized at all. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ac8e41c77785db7a486b8102360bea785"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">unsigned EncoreBootImage::BootCommand::getBlockCount </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the total number of cipher blocks. </p>
<p>The default implementation returns 0, indicating that no blocks are available. </p>

<p>Reimplemented from <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator.html#a14925c15a37596d24592165d16b58d3d">elftosb::EncoreBootImage::CipherBlockGenerator</a>.</p>

</div>
</div>
<a class="anchor" id="acd1b5489a1a8899b707a9b366d0971c8"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">unsigned EncoreBootImage::BootCommand::getBlocks </td>
          <td>(</td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>maxCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">cipher_block_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the contents of up to <em>maxCount</em> cipher blocks. </p>
<p>Up to <em>maxCount</em> cipher blocks are copied into the buffer pointed to by the <em>data</em> argument. The index of the first block to copy is held in the <em>offset</em> argument.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">offset</td><td>Starting block number to copy. Zero means the first available block. </td></tr>
    <tr><td class="paramname">maxCount</td><td>Up to this number of blocks may be copied into <em>data</em>. Must be 1 or greater. </td></tr>
    <tr><td class="paramname">data</td><td>Buffer for outgoing cipher blocks. Must have enough room to hold <em>maxCount</em> blocks.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of cipher blocks copied into <em>data</em>. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>No more blocks are available and nothing was written to <em>data</em>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::out_of_range</td><td>If <em>offset</em> is invalid. </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented from <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_cipher_block_generator.html#a7a0b3fc7d51d41d38b0c30da233b4fa4">elftosb::EncoreBootImage::CipherBlockGenerator</a>.</p>

</div>
</div>
<a class="anchor" id="a63457e77b2372a479df45aa9a1c205b0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual unsigned elftosb::EncoreBootImage::BootCommand::getDataBlockCount </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the number of data cipher blocks that follow this command. </p>
<p>The default implementation returns 0, indicating that no data blocks are available. </p>

<p>Reimplemented in <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_load_command.html#acb6824278d6bf8ca9bae7c6f80bc5a8c">elftosb::EncoreBootImage::LoadCommand</a>.</p>

</div>
</div>
<a class="anchor" id="a46b3519a49537325f27f3ec556ed176d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual unsigned elftosb::EncoreBootImage::BootCommand::getDataBlocks </td>
          <td>(</td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>maxCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">cipher_block_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the contents of up to <em>maxCount</em> data blocks. </p>
<p>Up to <em>maxCount</em> data blocks are copied into the buffer pointed to by the <em>data</em> argument. This is only a request for <em>maxCount</em> blocks, the subclass implementation of this method is free to return any number of blocks from 0 up to <em>maxCount</em>. A return value of 0 indicates that no more blocks are available. The index of the first block to copy is held in the <em>offset</em> argument.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">offset</td><td>Starting block number to copy. Zero means the first available block. </td></tr>
    <tr><td class="paramname">maxCount</td><td>Up to this number of blocks may be copied into <em>data</em>. Must be 1 or greater. </td></tr>
    <tr><td class="paramname">data</td><td>Buffer for outgoing data blocks. Must have enough room to hold <em>maxCount</em> blocks.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of data blocks copied into <em>data</em>. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>No more blocks are available and nothing was written to <em>data</em>. </td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_load_command.html#a5f8de3074ec88c92887a26c175ddfc6f">elftosb::EncoreBootImage::LoadCommand</a>.</p>

</div>
</div>
<a class="anchor" id="ac7e73ff007dd5a179952b089930e684a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void elftosb::EncoreBootImage::BootCommand::initFromData </td>
          <td>(</td>
          <td class="paramtype">const cipher_block_t *&#160;</td>
          <td class="paramname"><em>blocks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned *&#160;</td>
          <td class="paramname"><em>consumed</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Read the command contents from raw data. </p>
<p>The subclass implementations should validate the contents of the command, including the fields of the command header in the first block. It should be assumed that only the tag field was examined to determine which subclass of <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html" title="Abstract base class for all bootloader commands. ">BootCommand</a> should be created.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">blocks</td><td>Pointer to the raw data blocks. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">count</td><td>Number of blocks pointed to by <em>blocks</em>. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">consumed</td><td>On exit, this points to the number of cipher blocks that were occupied by the command. Should be at least 1 for every command. This must not be NULL on entry! </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_mem_enable_command.html#a811e4923ce935613bfd45cc9bdac513f">elftosb::EncoreBootImage::MemEnableCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_reset_command.html#a6a550a20cf322cf022f9514336d5c261">elftosb::EncoreBootImage::ResetCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_jump_command.html#aadfc133bb7d8b843bc44f432d479d2fb">elftosb::EncoreBootImage::JumpCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_program_command.html#a928d925992aadedd7be7f718e87a6611">elftosb::EncoreBootImage::ProgramCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_erase_command.html#aa4e563a035482c6dd1cae7bba6a74dc0">elftosb::EncoreBootImage::EraseCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_mode_command.html#a25b14e480aeb0737b8f117b6602b3d0e">elftosb::EncoreBootImage::ModeCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_fill_command.html#abb1c193d7adfa181ff50ed6c81731931">elftosb::EncoreBootImage::FillCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_load_command.html#a203f5100b5104459a593b5146821af95">elftosb::EncoreBootImage::LoadCommand</a>, <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_tag_command.html#ac3230910f89a9fd3eb2080962308c750">elftosb::EncoreBootImage::TagCommand</a>, and <a class="el" href="classelftosb_1_1_encore_boot_image_1_1_nop_command.html#a4c521124f080e25b32115822c2510fe0">elftosb::EncoreBootImage::NopCommand</a>.</p>

</div>
</div>
<a class="anchor" id="a5ed39355be6653d7665cb91ef24361e5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void EncoreBootImage::BootCommand::validateHeader </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> *&#160;</td>
          <td class="paramname"><em>modelHeader</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classelftosb_1_1_encore_boot_image.html#structelftosb_1_1_encore_boot_image_1_1boot__command__t">boot_command_t</a> *&#160;</td>
          <td class="paramname"><em>testHeader</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>whichFields</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>The checksum field of <em>testHeader</em> is always computed and checked against itself. All other fields are compared to the corresponding value set in <em>modelHeader</em> if the appropriate flag is set in <em>whichFields</em>. For example, the m_address fields in <em>testHeader</em> and <em>modelHeader</em> are compared when the CMD_ADDRESS_FIELD bit is set in <em>whichFields</em>. An exception is thrown if any comparison fails.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">modelHeader</td><td>The baseline header to compare against. Only those fields that have corresponding bits set in <em>whichFields</em> need to be set. </td></tr>
    <tr><td class="paramname">testHeader</td><td>The actual command header which is being validated. </td></tr>
    <tr><td class="paramname">whichFields</td><td>A bitfield used to determine which fields of the boot command header are compared. Possible values are:<ul>
<li>CMD_TAG_FIELD</li>
<li>CMD_FLAGS_FIELD</li>
<li>CMD_ADDRESS_FIELD</li>
<li>CMD_COUNT_FIELD</li>
<li>CMD_DATA_FIELD</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::runtime_error</td><td>Thrown if any requested validation fails. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_encore_boot_image_8h_source.html">EncoreBootImage.h</a></li>
<li>EncoreBootImage.cpp</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>elftosb</b></li><li class="navelem"><a class="el" href="classelftosb_1_1_encore_boot_image.html">EncoreBootImage</a></li><li class="navelem"><a class="el" href="classelftosb_1_1_encore_boot_image_1_1_boot_command.html">BootCommand</a></li>
    <li class="footer">Generated on Mon Mar 7 2016 16:49:51 for Kinetis Bootloader Host by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
